package com.haixiaoke.saas.tenant.service.impl;

import com.haixiaoke.saas.common.core.domain.entity.SysMenu;
import com.haixiaoke.saas.tenant.domain.TenantMenu;
import com.haixiaoke.saas.tenant.mapper.TenantMenuMapper;
import com.haixiaoke.saas.tenant.service.ITenantMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 机构和菜单的关联Service业务层处理
 *
 * @author panda
 * @date 2024-02-29
 */
@Service
public class TenantMenuServiceImpl implements ITenantMenuService {
    @Autowired
    private TenantMenuMapper tenantMenuMapper;

    /**
     * 查询机构和菜单的关联
     *
     * @param depId 机构和菜单的关联主键
     * @return 机构和菜单的关联
     */
    @Override
    public TenantMenu selectDepMenuByDepId(Long depId) {
        return tenantMenuMapper.selectDepMenuByDepId(depId);
    }

    /**
     * 查询机构和菜单的关联列表
     *
     * @param TenantMenu 机构和菜单的关联
     * @return 机构和菜单的关联
     */
    @Override
    public List<TenantMenu> selectDepMenuList(TenantMenu TenantMenu) {
        return tenantMenuMapper.selectDepMenuList(TenantMenu);
    }

    /**
     * 新增机构和菜单的关联
     *
     * @param TenantMenu 机构和菜单的关联
     * @return 结果
     */
    @Override
    public int insertDepMenu(TenantMenu TenantMenu) {
        return tenantMenuMapper.insertDepMenu(TenantMenu);
    }

    /**
     * 修改机构和菜单的关联
     *
     * @param TenantMenu 机构和菜单的关联
     * @return 结果
     */
    @Override
    public int updateDepMenu(TenantMenu TenantMenu) {
        return tenantMenuMapper.updateDepMenu(TenantMenu);
    }

    /**
     * 批量删除机构和菜单的关联
     *
     * @param tenantIds 需要删除的机构和菜单的关联主键
     * @return 结果
     */
    @Override
    public int deleteDepMenuByDepIds(String[] tenantIds) {
        return tenantMenuMapper.deleteDepMenuByDepIds(tenantIds);
    }

    /**
     * 删除机构和菜单的关联信息
     *
     * @param tenantId 机构和菜单的关联主键
     * @return 结果
     */
    @Override
    public int deleteDepMenuByDepId(String tenantId) {
        return tenantMenuMapper.deleteDepMenuByDepId(tenantId);
    }

    @Override
    public int insertBatchDepMenu(List<TenantMenu> depMenuList) {
        return tenantMenuMapper.insertBatchDepMenu(depMenuList);
    }

    @Override
    public List<Long> selectMenuIdsByDepId(String tenantId) {
        return tenantMenuMapper.selectMenuIdsByDepId(tenantId);
    }

    @Override
    public List<SysMenu> selectMenuByDepId(String tenantId) {
        return tenantMenuMapper.selectMenuByDepId(tenantId);
    }

    @Override
    public int deleteTenantMenuByMenuId(Long menuId) {
        return tenantMenuMapper.deleteTenantMenuByMenuId(menuId);
    }
}
